<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
    <th:block th:include="include :: header('修改系统任务')" />
</head>
<body class="white-bg">
    <div class="wrapper wrapper-content animated fadeInRight ibox-content">
        <form class="form-horizontal m" id="form-task-edit" th:object="${sysOaTask}">
            <div class="form-group">
                <label class="col-sm-3 control-label is-required">任务编号：</label>
                <div class="col-sm-8">
                    <input name="taskNo" th:field="*{taskNo}" class="form-control" type="text" readonly>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label is-required">任务名称：</label>
                <div class="col-sm-8">
                    <input name="taskName" th:field="*{taskName}" class="form-control" type="text" required>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">任务类型：</label>
                <div class="col-sm-8">
                    <div class="radio-box" th:each="dict : ${@dict.getType('sys_task_type')}">
                        <input type="radio" th:id="${'taskType_' + dict.dictCode}" name="taskType" th:value="${dict.dictValue}" th:field="*{taskType}">
                        <label th:for="${'taskType_' + dict.dictCode}" th:text="${dict.dictLabel}"></label>
                    </div>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label is-required">紧急程度：</label>
                <div class="col-sm-8">
                    <div class="radio-box" th:each="dict : ${@dict.getType('sys_oa_task_priority')}">
                        <input type="radio" th:id="${'taskType_' + dict.dictCode}" name="priority" th:value="${dict.dictValue}" th:checked="${dict.default}">
                        <label th:for="${'taskType_' + dict.dictCode}" th:text="${dict.dictLabel}"></label>
                    </div>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">任务内容：</label>
                <div class="col-sm-8">
                    <textarea name="taskContent" class="form-control" rows="7" th:field="*{taskContent}"></textarea>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">执行人：</label>
                <div class="col-sm-8">
                    <div class="input-group">
                        <input class="form-control" type="hidden" name="taskDistributeId"  id="taskDistributeId" th:field="*{taskDistributeId}">
                        <input class="form-control" type="text" name="transitionPersonName" onclick="selectUserInfo()" id="transitionPersonName" readonly="true">
                        <span class="input-group-addon"><i class="fa fa-search"></i></span>
                    </div>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">任务状态：</label>
                <div class="col-sm-8">
                    <select name="taskStatus" class="form-control m-b" th:with="type=${@dict.getType('ding_task_status')}">
                        <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}" th:field="*{taskStatus}"></option>
                    </select>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">任务来源：</label>
                <div class="col-sm-8">
                    <input name="taskSource" th:field="*{taskSource}" class="form-control" type="text">
                </div>
            </div>
        </form>
    </div>
    <th:block th:include="include :: footer" />
    <script th:inline="javascript">
        var prefix = ctx + "system/task";
        $("#form-task-edit").validate({
            focusCleanup: true
        });
        function selectUserInfo() {
            var url = "/system/user/selectMultiUser";
            $.modal.open("选择用户",url,"","",doSubmit);
        }
        function submitHandler() {
            if ($.validate.form()) {
                $.operate.save(prefix + "/edit", $('#form-task-edit').serialize());
            }
        }

        function doSubmit(index, layero){
            var body = layer.getChildFrame('body', index);
            var iframeWin = layero.find('iframe')[0];
            iframeWin.contentWindow.submitHandler(index, layero);
            $("#taskDistributeId").val(body.find('#id').val());
            $("#transitionPersonName").val(body.find('#userName').val());
            layer.close(index);
        }
    </script>
</body>
</html>